import { GSprite } from "../../../../../com/mui/controls/GSprite";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GuildUnionNameTip } from "./GuildUnionNameTip";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { DisplayUtil } from "../../../../common/DisplayUtil";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
import { GBitmap } from "../../../../../com/mui/controls/GBitmap";
type int = number;
//class GuildUnionAlloBar
    
    export  class GuildUnionAlloBar extends GSprite
    {
        constructor()
        {
            super();
            this._rec = new Object /* flash.geom.Rectangle */();
            return;
        }

        protected /* override */ createDisposedChildrenImpl(): void
        {
            this._barBg = ObjCreate.createBg(0, 0, 550, 36, this, ImagesConst.ProgressBottomBg);
            this._progressBar1 = ObjCreate.createBg(24, 0, 100, 10, this, ImagesConst.EnergyBar);
            this._progressBar2 = ObjCreate.createBg(24, 0, 100, 10, this, ImagesConst.Mofatiao);
            this._rec.x = 0;
            this._rec.y = 0;
            this._rec.width = 0;
            this._rec.height = this._progressBar2.height;
            this._progressBar2.scrollRect = this._rec;
            this._point1 = ObjCreate.createGBitmap(ImagesConst.ControlBarBig, 10, 0, this);
            this._point2 = ObjCreate.createGBitmap(ImagesConst.ControlBarBig, 10, 0, this);
            this._point3 = ObjCreate.createGBitmap(ImagesConst.ProgressLight, 10, 0, this);
            this._tip1 = new GuildUnionNameTip();
            this.addChild(this._tip1);
            this._tip2 = new GuildUnionNameTip();
            this.addChild(this._tip2);
            this._tip3 = new GuildUnionNameTip();
            this.addChild(this._tip3);
            this._tip1.visible = false;
            this._tip2.visible = false;
            this._tip3.visible = false;
            var loc1=new GTextFormat(FontUtil.stXingkaiName, 18, 16776960);
            this._label1 = ObjCreate.createGTextField("", 0, 0, 100, 20, this, loc1);
            this._label2 = ObjCreate.createGTextField("", 0, 0, 100, 20, this, loc1);
            this._label3 = ObjCreate.createGTextField("", 0, 0, 100, 20, this, loc1);
            return;
        }

        protected /* override */ disposeImpl(arg1: Boolean=true): void
        {
            super.disposeImpl(arg1);
            if (this._barBg) 
            {
                this._barBg.dispose();
                this._barBg = null;
            }
            if (this._progressBar1) 
            {
                this._progressBar1.dispose();
                this._progressBar1 = null;
            }
            if (this._progressBar2) 
            {
                this._progressBar2.dispose();
                this._progressBar2 = null;
            }
            if (this._point1) 
            {
                this._point1.dispose();
                this._point1 = null;
            }
            if (this._point2) 
            {
                this._point2.dispose();
                this._point2 = null;
            }
            if (this._point3) 
            {
                this._point3.dispose();
                this._point3 = null;
            }
            if (this._tip1) 
            {
                DisplayUtil.removeMe(this._tip1);
                this._tip1.dispose();
                this._tip1 = null;
            }
            if (this._tip2) 
            {
                DisplayUtil.removeMe(this._tip2);
                this._tip2.dispose();
                this._tip2 = null;
            }
            if (this._tip3) 
            {
                DisplayUtil.removeMe(this._tip3);
                this._tip3.dispose();
                this._tip3 = null;
            }
            if (this._label1) 
            {
                this._label1.dispose();
                this._label1 = null;
            }
            if (this._label2) 
            {
                this._label2.dispose();
                this._label2 = null;
            }
            if (this._label3) 
            {
                this._label3.dispose();
                this._label3 = null;
            }
            return;
        }

        public setSize(arg1: int, arg2: int): void
        {
            this._outWidth = arg1;
            this._outHeight = arg2;
            if (!isDisposed) 
            {
                this._barBg.width = arg1;
                this._barBg.height = arg2;
                this._label1.y = arg2 / 2 - 10;
                this._label2.y = arg2 / 2 - 10;
                this._label3.y = arg2 / 2 - 10;
                this._progressBar1.x = 24;
                this._progressBar1.y = 13;
                this._progressBar1.width = arg1 - 44;
                this._progressBar1.height = arg2 - 26;
                this._progressBar2.x = 24;
                this._progressBar2.y = 13;
                this._progressBar2.width = arg1 - 44;
                this._progressBar2.height = arg2 - 26;
                this._point1.y = (arg2 - this._point1.height) / 2;
                this._point2.y = (arg2 - this._point2.height) / 2;
                this._point3.x = this._progressBar1.x + this._progressBar1.width - this._point3.width / 2;
                this._point3.y = (arg2 - this._point3.height) / 2;
                this._tip1.y = arg2 - 22;
                this._tip2.y = arg2 - 22;
                this._tip3.y = arg2 - 22;
            }
            return;
        }

        public setValues(arg1: int, arg2: int, arg3: int, arg4: string, arg5: string, arg6: string): void
        {
            if (!isDisposed) 
            {
                if (arg1 > 0) 
                {
                    this._label1.text = arg1 + "%";
                    this._label1.x = this._progressBar1.x + (this._progressBar1.width * arg1 / 100 - this._label1.textWidth) / 2;
                    this._point1.x = this._progressBar1.x + this._progressBar1.width * arg1 / 100 - this._point1.width / 2;
                    this._point1.visible = true;
                    this._tip1.x = this._label1.x + this._label1.textWidth / 2;
                    this._tip1.setGuildName(arg4);
                    this._tip1.visible = true;
                }
                else 
                {
                    this._label1.text = "";
                    this._label1.x = 0;
                    this._point1.x = 0;
                    this._point1.visible = false;
                    this._tip1.visible = false;
                }
                if (arg2 > 0) 
                {
                    this._label2.text = arg2 + "%";
                    this._label2.x = this._progressBar1.x + this._progressBar1.width * (arg1 + arg2 / 2) / 100 - this._label2.textWidth / 2;
                    this._rec.x = this._progressBar1.width * arg1 / 100;
                    this._rec.width = this._progressBar1.width * arg2 / 100;
                    this._rec.height = this._progressBar1.height;
                    this._progressBar2.scrollRect = this._rec;
                    this._progressBar2.x = this._progressBar1.x + this._rec.x;
                    this._progressBar2.visible = true;
                    this._tip2.x = this._label2.x + this._label2.textWidth / 2;
                    this._tip2.setGuildName(arg5);
                    this._tip2.visible = true;
                }
                else 
                {
                    this._label2.text = "";
                    this._label2.x = 0;
                    this._progressBar2.visible = false;
                    this._tip2.visible = false;
                }
                if (arg3 > 0) 
                {
                    this._label3.text = arg3 + "%";
                    this._label3.x = this._progressBar1.x + this._progressBar1.width - this._progressBar1.width * arg3 / 100 / 2 - this._label3.textWidth / 2;
                    this._point2.x = this._progressBar1.x + this._progressBar1.width * (1 - arg3 / 100) - this._point2.width / 2;
                    this._point2.visible = true;
                    this._tip3.x = this._label3.x + this._label3.textWidth / 2;
                    this._tip3.setGuildName(arg6);
                    this._tip3.visible = true;
                }
                else 
                {
                    this._label3.text = "";
                    this._label3.x = 0;
                    this._point2.x = 0;
                    this._point2.visible = false;
                    this._tip3.visible = false;
                }
            }
            return;
        }

        protected /* var */_label1: GTextFiled;

        protected /* var */_label2: GTextFiled;

        protected /* var */_label3: GTextFiled;

        protected /* var */_barBg: ScaleBitmap;

        protected /* var */_progressBar1: ScaleBitmap;

        protected /* var */_progressBar2: ScaleBitmap;

        protected /* var */_point1: GBitmap;

        protected /* var */_point2: GBitmap;

        protected /* var */_point3: GBitmap;

        protected /* var */_tip1: GuildUnionNameTip;

        protected /* var */_tip2: GuildUnionNameTip;

        protected /* var */_tip3: GuildUnionNameTip;

        protected /* var */_rec: Object /* flash.geom.Rectangle */;

        /* internal */ /* var */_outWidth: int;

        /* internal */ /* var */_outHeight: int;
    }
